//
//  KQChatViewLayoutAttributesInfo.swift
//  JChat
//
//  Created by JIGUANG on 10/04/2017.
//  Copyright © 2017 HXHG. All rights reserved.
//

import UIKit

@objc open class KQChatViewLayoutAttributesInfo: NSObject {
    
    public init(message: KQMessageType, size: CGSize, rects: [KQChatViewLayoutItem: CGRect], boxRects: [KQChatViewLayoutItem: CGRect]) {
        _message = message
        _cacheSize = size
        _allLayoutedRects = rects
        _allLayoutedBoxRects = boxRects
        super.init()
    }
    
    open var message: KQMessageType {
        return _message
    }
    
    open func layoutedRect(with item: KQChatViewLayoutItem) -> CGRect {
        return _allLayoutedRects[item] ?? .zero
    }
    open func layoutedBoxRect(with item: KQChatViewLayoutItem) -> CGRect {

        return _allLayoutedBoxRects[item] ?? .zero
    }
    
    private var _message: KQMessageType
    private var _cacheSize: CGSize
    
    private var _allLayoutedRects: [KQChatViewLayoutItem: CGRect]
    private var _allLayoutedBoxRects: [KQChatViewLayoutItem: CGRect]
    
}
